package cn.mahjong.utils;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class IocUtil {

    /**
     * 通过父类获取子类
     *
     * @param superClass
     * @param <T>
     * @return
     */
    public static  <T> List<T> getChildBean(Class<?> superClass) {
        List<T> data = new ArrayList<>();
        Map<String, Object> all = cn.hserver.core.ioc.IocUtil.getAll();
        for (Object value : all.values()) {
            if (superClass.isAssignableFrom(value.getClass())) {
                data.add((T) value);
            }
        }
        return data;
    }

}
